{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0;
        margin-top: 0
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">

            {include file="public/topsection"}

            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar" style="text-align: center;margin-bottom: 20px">
                        <h2>人数: <font color="#1ab394">{$count}</font></h2>
                    </div>
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='type'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['type'=>'1'])}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">付费会员</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='2'}asdlkjasd{/eq}"
                           href="{:url('indexs',['type'=>'2'])}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">真人认证</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='3'}asdlkjasd{/eq}"
                           href="{:url('indexs',['type'=>'3'])}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">今日注册</a>
                        <a class="btn btn-default btn-outline {eq name='notparent' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['notparent'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">垂直用户</a>
                        <a class="btn btn-default btn-outline {eq name='realnameauth' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['realnameauth'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">未实名用户</a>
                    </div>
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='sex'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='sex' value='男'}asdlkjasd{/eq}"
                           href="{:url('indexs',['sex'=>'男'])}{present name='type'}/type/{$type}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">男&nbsp;&nbsp;性</a>
                        <a class="btn btn-default btn-outline {eq name='sex' value='女'}asdlkjasd{/eq}"
                           href="{:url('indexs',['sex'=>'女'])}{present name='type'}/type/{$type}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">女&nbsp;&nbsp;性</a>
                        <a class="btn btn-default btn-outline {eq name='zhuxiao' value='1'}asdlkjasd{/eq}" href="{:url('indexs',['zhuxiao'=>'1'])}">已注销</a>
                        <a class="btn btn-default btn-outline {eq name='is_banned' value='1'}asdlkjasd{/eq}" href="{:url('indexs',['is_banned'=>'1'])}">冻结</a>
                    </div>
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='is_online'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='is_online' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['is_online'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">在&nbsp;&nbsp;线</a>
                    </div>
                    <!-- <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='xuni'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='xuni' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['xuni'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">真&nbsp;&nbsp;实</a>
                        {eq name='admin.type' value='1'}
                        <a class="btn btn-default btn-outline {eq name='xuni' value='2'}asdlkjasd{/eq}"
                           href="{:url('indexs',['xuni'=>'2'])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">虚&nbsp;&nbsp;拟</a>
                        {/eq}
                    </div> -->
                    <!--<div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='recommend'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='recommend' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['recommend'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">推&nbsp;&nbsp;荐</a>
                    </div>-->
                    <!--<div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='reward'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='reward' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['reward'=>'1'])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{/present}{present name='is_contact'}/is_contact/{$is_contact}{/present}">收益排行</a>
                    </div>-->
                    <!--<div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='is_contact'}{else /}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {eq name='is_contact' value='0'}asdlkjasd{/eq}"
                           href="{:url('indexs',['is_contact'=>0])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}">未联系</a>
                        <a class="btn btn-default btn-outline {eq name='is_contact' value='1'}asdlkjasd{/eq}"
                           href="{:url('indexs',['is_contact' => 1])}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='recommend'}/recommend/{$recommend}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}">已联系</a>
                    </div>-->

                    <div class="fixed-table-toolbar" style="display:inline-block;">
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:60px">
                        排&nbsp;&nbsp;序：

                        <a class="btn btn-default btn-outline {present name='time'}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='time'}/time/{$time}{else /}/time/1{/present}">注&nbsp;&nbsp;册</a>
                        <a class="btn btn-default btn-outline {present name='balance'}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='balance'}/balance/{$balance}{else /}/balance/1{/present}">余&nbsp;&nbsp;额</a>
                        <a class="btn btn-default btn-outline {present name='score'}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='score'}/score/{$score}{else /}/score/1{/present}">积&nbsp;&nbsp;分</a>
                        <a class="btn btn-default btn-outline {present name='logintime'}asdlkjasd{/present}"
                           href="{:url('indexs')}{present name='type'}/type/{$type}{/present}{present name='sex'}/sex/{$sex}{/present}{present name='is_online'}/is_online/{$is_online}{/present}{present name='xuni'}/xuni/{$xuni}{/present}{present name='logintime'}/logintime/{$logintime}{else /}/logintime/1{/present}">最后登录时间正序</a>
                    </div>
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:60px">
                        用户质量：

                        <a class="btn btn-default btn-outline {notpresent name='quality'}asdlkjasd{/notpresent}" href="{:url('indexs')}">全&nbsp;&nbsp;部</a>
                        <a class="btn btn-default btn-outline {present name='quality'}{eq name='quality' value='0'}asdlkjasd{/eq}{/present}" href="{:url('indexs', ['quality'=>0])}">未检出</a>
                        <a class="btn btn-default btn-outline {present name='quality'}{eq name='quality' value='1'}asdlkjasd{/eq}{/present}" href="{:url('indexs', ['quality'=>1])}">低端</a>
                        <a class="btn btn-default btn-outline {present name='quality'}{eq name='quality' value='2'}asdlkjasd{/eq}{/present}" href="{:url('indexs', ['quality'=>2])}">一般</a>
                        <a class="btn btn-default btn-outline {present name='quality'}{eq name='quality' value='3'}asdlkjasd{/eq}{/present}" href="{:url('indexs', ['quality'=>3])}">优质</a>
                        <a class="btn btn-default btn-outline {present name='quality'}{eq name='quality' value='4'}asdlkjasd{/eq}{/present}" href="{:url('indexs', ['quality'=>4])}">超优质</a>
                    </div>
                    </div>

                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">
                        <form method="get" action="" style="display: flex;">
                            <div class="pull-left search" style="display: flex;">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search">
                                        <option value="id" {php}if(input(
                                        '?param.search')){if(input('param.search')=='id'){echo "selected";}
                                        }{/php}>ID</option>
                                        <option value="name" {php}if(input(
                                        '?param.search')){if(input('param.search')=='name'){echo "selected";}
                                        }{/php}>昵称</option>
                                        <option value="phone" {php}if(input(
                                        '?param.search')){if(input('param.search')=='phone'){echo "selected";}
                                        }{/php}>手机</option>
                                        <option value="city" {php}if(input(
                                        '?param.search')){if(input('param.search')=='city'){echo "selected";}
                                        }{/php}>城市</option>
                                        <option value="yqm" {php}if(input(
                                        '?param.search')){if(input('param.search')=='yqm'){echo "selected";}
                                        }{/php}>邀请码</option>
                                        <option value="device_id" {php}if(input(
                                        '?param.search')){if(input('param.search')=='device_id'){echo "selected";}
                                        }{/php}>设备号</option>
                                    </select>
                                </div>

                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                           {php}
                                           if(input('?param.name')){
                                    if(input('param.name')){
                                    echo "value='".input('name')."'";
                                    }

                                    }
                                    {/php}
                                    name="name" placeholder="搜索">
                                </div>

                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px"
                                            class="btn btn-default btn-outline" type="submit">搜索
                                    </button>
                                </div>
                                <div class="columns columns-right btn-group pull-left" style="margin-left: 10px;">
                                    <select class="form-control" id="time_type" name="time_type">
                                        <option value="register_datetime" {php}if(input(
                                        '?param.time_type')){if(input('param.time_type')=='register_datetime'){echo "selected";}
                                        }{/php}>注册时间</option>
                                        <option value="last_login_time" {php}if(input(
                                        '?param.time_type')){if(input('param.time_type')=='last_login_time'){echo "selected";}
                                        }{/php}>登录时间</option>
                                        <option value="last_login_datetime" {php}if(input(
                                        '?param.time_type')){if(input('param.time_type')=='last_login_datetime'){echo "selected";}
                                        }{/php}>刷线在线时间</option>
                                    </select>
                                </div>

                                <input name="datemin" type="text" id="datemin" class="form-control layui-input" value="{present name="datemin"}{$datemin}{/present}" placeholder="最小时间" autocomplete="off" style="height:34px;width:160px;margin-right:0px;">
                                <input name="datemax" type="text" id="datemax" class="form-control layui-input" value="{present name="datemax"}{$datemax}{/present}" placeholder="最大时间" autocomplete="off" style="height:34px;width:160px;margin:0 10px;">

                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('indexs')}">返回列表</a>
                                </div>
                                {php}
                                }
                                {/php}


                                {if condition='$uniaccount'}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-danger" onclick="adddovetail()">手动添加关联</a>
                                </div>
                                {/if}
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center" data-width="6%">邀请人</th>
                                    {if condition='$uniaccount'}
                                    <th data-align="center">关联描述</th>
                                    {/if}
                                    <th data-align="center">ID</th>
                                    <th data-align="center">头像</th>
                                    <th data-align="center">昵称</th>
                                    <th data-align="center">性别</th>
                                    <th data-align="center">账号数量</th>
                                    <th data-align="center">城市</th>
                                    <th data-align="center">手机</th>
                                    <th data-align="center">金币</th>
                                    <th data-align="center">积分</th>
                                    <th data-align="center">总充值</th>
                                    <th data-align="center">总消费</th>
                                    <th data-align="center">总收益</th>
                                    {present name='reward'}
                                        {eq name='$reward' value='1'}
                                            <th data-align="center">收益</th>
                                            <th data-align="center">虚拟收益</th>
                                        {/eq}
                                    {/present}
                                    <th data-align="center">总提现</th>
                                    <th data-align="center">邀请码</th>
                                    <th data-align="center">团队</th>
                                    <th data-align="center">VIP</th>
                                    <!--<th data-align="center">推荐</th>-->
                                    <th data-align="center">真人认证</th>
                                    <th data-align="center">实名认证</th>
                                    <th data-align="center">实名</th>
                                    <th data-align="center">最后在线时间</th>
                                    <th data-width="80" data-align="center">危险标签</th>
                                    <th data-width="80" data-align="center">用户质量</th>
                                    <!--<th data-align="center">排序</th>
                                    <th data-align="center">联系客户</th>
                                    <th data-align="center">状态</th>-->
                                    <th data-align="center">管理</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {php}$hide=array('0'=>'<font color="#1ab394">正常</font>','1'=>'<font
                                        color="#f00">冻结</font>');{/php}
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                    <!--<td><a onclick="member('{$v.yqr}')" style="color:#40BCF7">{:yqmuser($v.yqr)}</a></td>-->
                                    <td><input class="form-control invite" type="text" onblur="input('{$v.id}')" value="{:yqmuser($v.yqr)}" placeholder="{$v.yqr}"></td>
                                    {if condition='$uniaccount'}
                                    <td>{$v.uniobject}{$v.uniobject == '手动关联' ? '<a onclick="dovetaildel(' . $v.id . ', '. input('name') .')">解除</a>' : ''}</td>
                                    {/if}
                                    <td>{$v.id}</td>
                                    <td>
                                            {php}
                                            $noHttp = strpos($v['head_100'], 'https://') === false;
                                            {/php}
                                        <a href="{php} if ($noHttp) {echo '__ROOT__';} {/php}{$v.head_100}" title="{$v.name}" target="_blank">
                                            <img style="width:40px;height:40px;" src="{php} if ($noHttp) {echo '__ROOT__';} {/php}{$v.head_100}"/>
                                        </a>
                                    </td>
                                    <td>{if condition='$v.delete_time'}<span style="color:red">{$v.name}</span>{else /}{$v.name}{/if}</td>
                                    <td>{$v.sex}</td>
                                    <td><a onclick="device('{$v.id}')" style="color:#40BCF7">{$v.device_account_count}</a></td>
                                    <td>{$v.city}</td>
                                    <td>{$v.phone}</td>
                                    <td>{$v.volley}</td>
                                    <td>{$v.score}</td>
                                    <td><a onclick="topup('{$v.id}')" style="color:#40BCF7">{:round($v.topup_sum / 10, 2)}</a></td>
                                    <td><a onclick="consume('{$v.id}')" style="color:#40BCF7">{:round($v.consume_sum / 10)}</a></td>
                                    <td><a onclick="income('{$v.id}')" style="color:#40BCF7">{:round($v.income_sum / 10)}</a></td>
                                    {present name='reward'}
                                        {eq name='$reward' value='1'}
                                            <td>{$v.shouyi}</td>
                                            <td>{$v.shouyi_xuni}</td>
                                        {/eq}
                                    {/present}
                                    <td><a onclick="withdraw('{$v.id}')" style="color:#40BCF7">{:round($v.withdraw_sum / 10)}</a></td>
                                    <td>{$v.yqm}</td>
                                    <td><a onclick="team('{$v.yqm}')" style="color:#40BCF7">查看</a></td>
                                    <td>
                                        {if condition='$v.noble_grade && $v.noble_time >= time() && isset($vip[$v.noble_grade])'}
                                            <span onClick="huiyuan(this,{$v.id}, '{:date('Y-m-d H:i:s', $v.noble_time)}', {$v.noble_grade})" style="color:#40BCF7;cursor:pointer;">
                                                {$vip[$v['noble_grade']]['name']}
                                                <br>
                                                {:date('Y-m-d H:i:s', $v.noble_time)}
                                            </span>
                                        {else /}
                                            <span onClick="huiyuan(this,{$v.id}, '{:date('Y-m-d H:i:s')}', 0)" style="color:#40BCF7;cursor:pointer;">
                                            选择
                                            </span>
                                        {/if}
                                    </td>
                                    <!--<td>
                                        {eq name="$v.is_recommend" value="1"} 推荐中 {/eq}
                                    </td>-->
                                    <td>
                                        {switch name="v.is_identity_authentication"}
                                            {case value="0"}<a style="color:#40BCF7;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'url' => -1])}')">未认证</a>{/case}
                                            {case value="1"}<a style="color:red;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'url' => -1])}')">待审核</a>{/case}
                                            {case value="2"}<a style="color:green;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'url' => -1])}')">通过</a>{/case}
                                            {default /}未通过
                                        {/switch}
                                    </td>
                                    <td>
                                        {switch name="v.realname_auth"}
                                            {case value="0"}<a style="color:#40BCF7;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'key'=>'realname_auth', 'url' => -1])}')">未认证</a>{/case}
                                            {case value="1"}<a style="color:red;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'key'=>'realname_auth', 'url' => -1])}')">待审核</a>{/case}
                                            {case value="2"}<a style="color:green;cursor:pointer;" onClick="add('{:url('revideoadd',['id'=>$v['id'], 'key'=>'realname_auth', 'url' => -1])}')">通过</a>{/case}
                                            {default /}未通过
                                        {/switch}
                                    </td>
                                    <td>{$v.user_realname}</td>
                                    <td>{:date('Y-m-d H:i', strtotime($v.last_login_datetime))}</td>
                                    <td><span style="color:red;">{$v.danger_tags_value}</span> <a onclick="setDangerTags({$v.id}, '{$v.danger_tags}')">设置</a></td>

                                    <td>
                                        <a onclick="setQuality({$v.id}, '{$v.quality}')">
                                        {php}
                                        $qualitys = ['未检出','低端','一般','优质','超优质'];
                                        {/php}
                                        {$qualitys[$v.quality]}
                                        </a>
                                    </td>
                                    <!--<td>{$v.sort}</td>
                                    <td>
                                        {eq name='$v.is_contact' value='1'}
                                            <a onClick="add('{:url('Operate/contact',['user_id'=>$v['id'],'url'=>-1])}')" style="color:#40BCF7">已联系</a>
                                        {else /}
                                            <a onClick="add('{:url('Operate/contact',['user_id'=>$v['id'],'url'=>-1])}')" style="color:red">未联系</a>
                                        {/eq}
                                    </td>
                                    <td id="hide">{$hide[$v['is_banned']]}</td>-->
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onClick="add('{:url('add',['id'=>$v['id'],'url'=>-1])}')">修改资料</a></li>
                                                <li class="divider"></li>
                                                <li><a onClick="add('{:url('personal',['id' => $v['id'], 'url' => -1])}')">个人配置</a></li>
                                                <li class="divider"></li>
                                                {eq name='admin.type' value='1'}
                                                    <!-- <li><a onClick="add('{:url('money',['id'=>$v['id'],'url'=>-1])}')">账户充值</a></li> -->
                                                    <li><a onClick="car(this, {$v.id})">赠送座驾</a></li>
                                                    <li class="divider"></li>
                                                {/eq}
                                                    <li><a onClick="frozen(this, {$v.id})">积分冻结</a></li>
                                                    <li><a onClick="topuplimit(this, {$v.id})">充值限额</a></li>
                                                    <li class="divider"></li>
                                                {eq name='admin.type' value='1'}
                                                    <li><a onClick="add('{:url('addvideo',['id'=>$v['id'],'url'=>-1])}')">上传视频</a></li>
                                                    <li><a onClick="add('{:url('addimage',['id'=>$v['id'],'url'=>-1])}')">上传照片</a></li>
                                                    <li><a onClick="add('{:url('addauthpic',['id'=>$v['id'],'url'=>-1])}')">上传历史身份证照片</a></li>
                                                {/eq}
                                                <li><a onClick="add('{:url('image',['id'=>$v['id'],'url'=>-1])}')">查看照片</a></li>
                                                </li>
                                                <li class="divider"></li>
                                                <li><a onClick="add('{:url('CustomerService/topupPrev',['user_id'=>$v['id'],'url'=>-1])}')">上级充值</a></li>
                                                <li><a onClick="add('{:url('CustomerUserService/topupPrev',['user_id'=>$v['id'],'url'=>-1])}')">账户充值</a></li>
                                                <li class="divider"></li>
                                                <li><a onClick="delchats({$v.id})" style="color:red">清空聊天记录</a></li>
                                                <li class="divider"></li>
                                                <li><a onClick="del({$v.id})" style="color:red">注销账号</a></li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div  class="btn btn-outline btn-default" onclick="exportData(0)">
                        批量导出
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData(1)">
                        导出男性
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData(1, 5000)">
                        导出男性(排除总充值超5000)
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportData(2)">
                        导出女性
                    </div>
                    <div  class="btn btn-outline btn-default" onclick="exportPhoneData()">
                        导出手机号
                    </div>
                    <!--<a href="?reward=1" type="button" class="btn btn-outline btn-default">
                        收益排序
                    </a>-->
                    {eq name='admin.type' value='1'}
                    <div  class="btn btn-outline btn-default" onclick="alla('del')">
                        批量删除
                    </div>
                    {/eq}
                </div>
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
<div id="xuanze" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <div style="margin-bottom:10px"></div>
    <div style="display: flex;align-items: center;position: relative;">
        <span style="position: absolute;left: -80px;">VIP等级：</span>
        <select class="form-control" name="search_typeid">
            {volist name='vip' id='v'}
            <option name="huiyuan" value="{$v.id}" id="grade_{$v.grade}" class="grade" {eq name="key" value="0" }selected{/eq}>{$v.name}</option>
            {/volist}
            <option name="huiyuan" value="0" style="color: red">关闭资格</option>
        </select>
    </div>
    <div style="margin-bottom:10px"></div>
    <div style="display: flex;align-items: center;position: relative;">
        <span style="position: absolute;left: -80px;">到期时间：</span>
        <input type="text" id="time" class="form-control layui-input" value="" autocomplete="off">
    </div>
</div>

<div id="car" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <div style="margin-bottom:10px"></div>
    <select class="form-control" name="search_typeid">
        {volist name='car' id='v'}
        <option name="car" value="{$v.id}" {eq name="key" value="0" }selected{/eq}>{$v.name}</option>
        {/volist}
    </select>
    <div style="margin-bottom:10px"></div>
    <input type="text" id="cartime" class="form-control layui-input" value="" autocomplete="off" placeholder="赠送天数">
</div>
<div id="frozen" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <div style="margin-bottom:10px"></div>
    <input type="number" id="frozenvalue" class="form-control layui-input" value="" autocomplete="off" placeholder="冻结数量">
    <input type="text" id="frozenremark" class="form-control layui-input" value="" autocomplete="off" placeholder="冻结说明">
</div>
<div id="topuplimit" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <div style="margin-bottom:10px"></div>
    <input type="number" id="topuplimitvalue" class="form-control layui-input" value="" autocomplete="off" placeholder="每日限额；0表示不限制">
</div>
<div id="dovetail" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <div style="margin-bottom:10px"></div>
    <input type="number" id="dovetailvalue" class="form-control layui-input" value="" autocomplete="off" placeholder="关联用户id">
</div>
<div id="dangertags" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <form></form>
</div>
<div id="quality" style="text-align:center;display:none;margin: 0px 30px;padding:10px 100px">
    <form></form>
</div>
{include file="public/footer" /}
{load href="__PLUGINS__iCheck/icheck.min.js"}
{load href="__PLUGINS__iCheck/custom.css"}

<script type="text/javascript">

    $(document).ready(function(){
        $('#desAll').click(function(){
            var des=$(".form-horizontal").serialize();
            ajaxFun("post",'{:url("desAll")}',des,'json',function(ret){
                if(ret){
                    if(ret.ret){
                        self.location.reload();
                    }else{
                        layer.msg(ret.err)
                    }
                }else{
                    swal_msg("错误",ret,"error");
                }
            })
        })

        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })

        layui.use('laydate', function () {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render ({
                elem : '#time', //指定元素
                type : 'datetime',
                trigger: 'click'
            });
        });
    });

    layui.use(['laydate'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#datemin' //指定元素
            ,type: 'datetime'
            ,trigger: 'click'
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#datemax' //指定元素
            ,type: 'datetime'
            ,trigger: 'click'
        });
    })

    function del(id) {
        swal_del(id, "{:url('del')}")
    }
    function delchats(id) {
        swal_dels(id, "{:url('delchats')}")
    }
    

    function huiyuan(obj, id, time, grade) {

        $("#time").val(time);

        if (grade) {
            var grade_name = 'grade_' + grade;
            $("#" + grade_name).prop("selected", "selected");
        } else {
            $(".grade").removeAttr("selected");
        }

        var index = layer.open({
            area: ['540px', '240px'],
            type: 1,
            title: '选择VIP',
            content: $('#xuanze'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var vip_id = $("option[name='huiyuan']:selected").val();
                var time = $("#time").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/admin/addhuiyuan')}",
                    data: {vip_id: vip_id, user_id: id, time:time},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }

    function car(obj, id) {

        var index = layer.open({
            area: ['540px', '240px'],
            type: 1,
            title: '选择VIP',
            content: $('#car'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var car_id = $("option[name='car']:selected").val();
                var time = $("#cartime").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/admin/addcar')}",
                    data: {car_id: car_id, user_id: id, time:time},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }
    function frozen(obj, id) {

        var index = layer.open({
            area: ['540px', '200px'],
            type: 1,
            title: '积分冻结',
            content: $('#frozen'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var value = $("#frozenvalue").val();
                var remark = $("#frozenremark").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/admin/frozen')}",
                    data: {value: value,remark: remark, user_id: id},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }
    function topuplimit(obj, id) {

        var index = layer.open({
            area: ['540px', '200px'],
            type: 1,
            title: '充值限额',
            content: $('#topuplimit'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var value = $("#topuplimitvalue").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/member/topuplimit')}",
                    data: {value: value, user_id: id},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }



    function alla(types){
        var all=$(".form-horizontal").serialize();
        var alls=$(".form-horizontal").serializeArray();
        //console.log(JSON.stringify(alls))

        ajaxFun("post",'{:url("delAll")}?type='+types,all,'json',function(ret){

            if(ret){
                var text
                switch(types)
                {
                    case 0:
                        text='<font color="#f00">隐藏</font>';
                        break;
                    case 1:
                        text='<font color="#1ab394">通过</font>'
                        break;
                    case 2:
                        text ='审核';
                        break;
                    case 3:
                        text ='<font color="#f00">拒绝</font>';
                        break;
                }
                for(var i=0;i<alls.length;i++){
                    if(types=='del'){
                        $('#id'+alls[i]['value']).remove();
                    }else{
                        $('#hide'+alls[i]['value']).html(text);
                    }
                }

                swal_msg('操作成功')
                window.location.reload();
            }
        })

    }

    function team(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("indexs")}?search=yqr&name='+id
            });
        });
    }

    function member(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("indexs")}?search=yqm&name='+id
            });
        });
    }
    function device(deviceid)
    {
        if(!deviceid){
            return layer.msg('注销账号和空设备号不可查看')
        }
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("indexs")}?search=uniaccount&name='+deviceid
            });
        });
    }

    function contact(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("operate/contact")}?user_id='+id
            });
        });
    }

    function topup(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("topup")}?state=1&search=id&name='+id
            });
        });
    }

    function consume(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("balance")}?types=0&type=id&name='+id
            });
        });
    }

    function income(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("shouyi/records")}?search=id&name='+id
            });
        });
    }

    function withdraw(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("tixian")}?search=id&name='+id
            });
        });
    }

    function exportData(sex, recharge = 0) {
        var sort = 0
        if ('{present name="time"}{$time}{/present}') {
            sort = 1
        } else if ('{present name="balance"}{$balance}{/present}') {
            sort = 2
        } else if ('{present name="score"}{$score}{/present}') {
            sort = 3
        } else if ('{present name="logintime"}{$logintime}{/present}') {
            sort = 4
        }
        var timekey = $('#time_type').val();
        var all=$(".form-horizontal").serialize();
        if ((!all && !sex) && !('{$datemin}' || '{$datemax}')) {
            layer.msg('未选中数据', {icon: 0});
        } else {
            window.location.href = '{:url("exportData")}?delAll='+all+'&datemin={$datemin}&datemax={$datemax}&sex='+sex+'&recharge='+recharge+'&sort='+sort+'&time_type='+timekey+'&quality={present name="quality"}{$quality}{/present}';
        }
    }
    function exportPhoneData() {
        var timekey = $('#time_type').val();
        var logintime = "{present name='sex'}{$logintime}{/present}";
        var sex = "{present name='sex'}{$sex}{/present}";
        var all=$(".form-horizontal").serialize();
        if (!all && !('{$datemin}' || '{$datemax}')) {
            layer.msg('未选中数据或筛选条件不足', {icon: 0});
        } else {
            window.location.href = '{:url("exportPhoneData")}?delAll='+all+'&datemin={$datemin}&datemax={$datemax}&sex='+sex+'&timekey='+timekey+'&logintime='+logintime;
        }
    }

    // 监听输入框
    function input(id){
        var val = $('#id'+id).find('.invite').val();

            /*if(!val){
                layer.msg('请输入邀请人ID');
                return;
            } else {*/
                layer.open({
                    content: '确认 绑定邀请人ID：' + val,
                    yes: function(index, layero){
                        //do something
                        layer.close(index); //如果设定了yes回调，需进行手工关闭

                        $.ajax({
                            type: 'post',
                            url: '{:url("inviteCode")}',
                            data: {id:id,prev_id:val},
                            dataType: 'json',
                            success:function(ret){
                                if (ret.ret) {
                                    layer.msg('设置成功')
                                    window.location.reload()
                                } else {
                                    layer.msg(ret.err);
                                }

                            },
                            error:function(err){
                                layer.msg(err)
                            }
                        });
                    }
                });
            /*}*/
    }

    function adddovetail(){

        var index = layer.open({
            area: ['540px', '200px'],
            type: 1,
            title: '充值限额',
            content: $('#dovetail'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var value = $("#dovetailvalue").val();
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/member/dovetail')}",
                    data: {value: value, user_id: "{:input('name')}"},
                    dataType: 'json',
                    success: function (data) {
                        if (data.state) {
                            layer.msg(data.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(data.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }

    

    function dovetaildel(uid, touid){
        layer.open({
            content: '确认 解除手动关联：' + uid + ' <==> ' + touid,
            yes: function(index, layero){
                layer.close(index); //如果设定了yes回调，需进行手工关闭
                $.ajax({
                    type: 'post',
                    url: '{:url("dovetaildel")}',
                    data: {uid,touid},
                    dataType: 'json',
                    success:function(data){
                        if (data.state) {
                            layer.msg(data.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(data.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error:function(err){
                        layer.msg(err)
                    }
                });
            }
        });
    }
    function setDangerTags(uid, now) {
        console.log(uid)
        console.log(now)
        now = now.split(',')
        let dangettags = JSON.parse('{:json_encode($dangerTags)}')
        let option = '';
        for(let ditem in dangettags){
            if(inArray(ditem, now)){
                option += '<input type="checkbox" name="dangettag[]" value="' + ditem + '" checked>' + dangettags[ditem] + ' <br>'
            }else{
                option += '<input type="checkbox" name="dangettag[]" value="' + ditem + '">' + dangettags[ditem] + ' <br>'
            }
        }
        $('#dangertags form').html(option)
        console.log(option)
        var index = layer.open({
            area: ['540px', '200px'],
            type: 1,
            title: '设置危险标签',
            content: $('#dangertags'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                let selectedItems = []
                $("input[name='dangettag[]']:checked").each(function() {
                    selectedItems.push($(this).val());
                });
                selectedItems = selectedItems.join(',')
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/admin/setDangerTags')}",
                    data: {value: selectedItems, user_id: uid},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }
    function setQuality(uid, now) {
        console.log(uid)
        console.log(now)
        let qualitys = [
            {
                name: '超优质',
                value: 4
            },
            {
                name: '优质',
                value: 3
            },
            {
                name: '一般',
                value: 2
            },
            {
                name: '低端',
                value: 1
            }
        ];
        let option = '<select class="form-control" id="qualityval">';
        for (let i = qualitys.length - 1; i >= 0; i--) {
            if(qualitys[i].value == now){
                option += '<option value="' + qualitys[i].value + '" checked>' + qualitys[i].name + ' </option>'
            }else{
                option += '<option value="' + qualitys[i].value + '">' + qualitys[i].name + ' </option>'
            }
        }
        option += '</select>';
        $('#quality form').html(option)
        var index = layer.open({
            area: ['540px', '200px'],
            type: 1,
            title: '设置用户质量',
            content: $('#quality'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                $.ajax({
                    type: 'POST',
                    url: "{:url('admin/admin/setQuality')}",
                    data: {value: $('#qualityval').val(), user_id: uid},
                    dataType: 'json',
                    success: function (date) {
                        if (date.state) {
                            layer.msg(date.msg, {icon: 1});
                            layer.close(index);
                            window.location.reload();
                        } else {
                            layer.msg(date.msg, {icon: 0});
                            layer.close(index);
                        }
                    },
                    error: function (e) {
                        layer.msg(e.responseText);
                    }
                });
            }
        })
    }
    function inArray(val, arr) {
        return arr.some(function (v) {
            return val === v;
        })
    }
</script>
 